package com.ymatou.iapi.quickturnover.service;

import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.quickturnover.parameter.resp.GetSellerAdvanceInfoResp;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*获取提前放款用户汇总信息详情接口Call
*FreeMaker Template自动生成代码
*/
public class GetSellerAdvanceInfoReqCall extends YmatouBaseCall{
	private static String opurl ="/api/GetSellerAdvanceInfo";
	
	public GetSellerAdvanceInfoReqCall() {
		super(EnvSetup.getSystemUrl("quickturnover_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	/**
	 * 获取code
	 * 
	 * @return
	 */
	public String getCode() {
		String code = null;
		try {
			code = new JSONObject(getReturnData()).getString("code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return code;
	}
	/**
	 * 获取bcode
	 * 
	 * @return
	 */
	public String getBcode() {
		String bcode =null;
		try {
			bcode = new JSONObject(getReturnData()).getString("bcode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bcode;
	}
	/**
	 * 获取Data
	 * 
	 * @return
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			Data = new JSONObject(getReturnData()).getJSONObject("data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}
	
	
    /**
 	 * @return
 	 */
 	public GetSellerAdvanceInfoResp getSellerAdvanceInfo(){
 		GetSellerAdvanceInfoResp sellerAdvanceInfoResp = null;	
 		try {
 			String rd
				 = getData().toString();
 			Gson gson = new Gson();
 			sellerAdvanceInfoResp = gson.fromJson(rd, new TypeToken<GetSellerAdvanceInfoResp>() {
 			}.getType());
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 		return sellerAdvanceInfoResp; 			
 	} 	
}